package com.itheima.file;

import java.io.File;
import java.util.HashMap;


public class Test03 {
    public static void main(String[] args) {
        File file = new File("day11_lianxi");
        HashMap<String, Integer> map = new HashMap<>();
        cont(map, file);
        System.out.println(map);
    }

    private static void cont(HashMap<String, Integer> map, File file) {
        int count = 0;
        if (file != null) {
            File[] files = file.listFiles();
            if (files != null) {
                for (File f : files) {
                    if (f.isDirectory()) {
                        cont(map, f);
                    } else {
                        String[] endName = f.getName().split("\\.");
                        for (int i = 0; i < endName.length; i++) {
                            if (i % 2 == 1) {
                                map.put(endName[i], count + 1);
                                count++;
                            }
                        }
                    }
                }
            }
        }
    }
}






